const { sequelize, QueryTypes } = require('../libs/mysql');

const getAccountAppCount = async (params) => {
    let paramsArray=[],i=0;
    paramsArray[i++]=params.outerInstanceId;
    let queryAccountUserCount = 'SELECT id AS appId, account_id AS accountId, account_name AS accountName, account_user_count AS accountUserCount, domain AS domain, agreement_company_name AS agreementCompanyName, group_name AS groupName, status AS status, outer_instance_id AS outerInstanceId, client_id AS clientId, app_key AS appKey, zlz_outer_instance_id AS zlzOuterInstanceId, app_secret AS appSecret, client_secret AS clientSecret, created_on AS createdOn, updated_on AS updatedOn FROM push_app_authorize WHERE zlz_outer_instance_id = ?';
    const [results, metadata] = await sequelize.query(queryAccountUserCount, {
        replacements: paramsArray,
        type: QueryTypes.SELECT
    });
    return results;
};

module.exports = {
    getAccountAppCount
};
